<template>
  <view class="demo-demo2">
    <view class="demo-demo2-content container">
      <view class="demo-demo2-title">
        <text class="text-primary">Demo Demo2</text>
      </view>
      <view class="mt-4 flex justify-center" v-if="demoStore.loading">
        <loading text="加载中..." />
      </view>
    </view>
  </view>
</template>

<script lang="ts">
export default {
  name: 'DemoDemo2Page'
}
</script>

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';
import Loading from '@/components/common/Loading.vue';
import { useDemoStore } from '../store';

// 使用模块状态
const demoStore = useDemoStore();

// 初始化数据
onMounted(() => {
  demoStore.fetchData();
});

// 页面卸载时重置状态
onUnmounted(() => {
  // 如果是模块主页，卸载时重置状态
  // 子页面一般不重置模块状态
});
</script>

<style lang="scss">
@import './index.scss';
</style>